package com.example.monile2021606177cke;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final EditText editText = findViewById(R.id.editText);
        final EditText editText2 = findViewById(R.id.editText2);
        final EditText editText3 = findViewById(R.id.editText3);
        final EditText editText4 = findViewById(R.id.editText4);
        Button button1=findViewById(R.id.button1);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String str=editText.getText().toString();
                String str1=editText2.getText().toString();
                String str2=editText3.getText().toString();
                String str3=editText4.getText().toString();

                if(str1.equals("123456")){
                    if (str2.equals(str3)){
                        Toast.makeText(MainActivity.this,"修改成功", Toast.LENGTH_SHORT).
                        show();
                    }else{
                        editText4.setText("两次密码不一致，请重新输入");
                    }
                }else {
                        editText3.setText("原密码错误");
                    }
                }
            });
}
}

